The UK TeX FAQ

ثبت نشده
چکیده

sty: macros/latex/contrib/abstract memoir.cls: macros/latex/contrib/memoir 198 Really blank pages between chapters If you’re using the standard classes, you need to take special action; the memoir classand the Koma-Script classes provide their own support for this — see below.Book (by default) and report (with openright class option) ensure that each chap-ter starts on a right-hand (recto) page; they do this by inserting a \cleardoublepagecommand between chapters (rather than a mere \clearpage). The empty page thuscreated gets to have a normal running header, which some people don’t like.The (excellent) fancyhdr manual covers this issue, basically advising the creationof a command \clearemptydoublepage: \let\origdoublepage\cleardoublepage\newcommand{\clearemptydoublepage}{%\clearpage{\pagestyle{empty}\origdoublepage}%} The “obvious” thing is then to use this command to replace \cleardoublepage in apatched version of the \chapter command. (Make a package of your own containinga copy of the command out of the class.) This isn’t particularly difficult, but you caninstead simply subvert \cleardoublepage (which isn’t often used elsewhere): \let\cleardoublepage\clearemptydoublepage Note: this command works because \clearemptydoublepage uses a copy of \cleardoublepage:instructions on macro programming patching techniques explain the problem and whythis is a solution.The emptypage package does this sort of thing for you; all you need do is load thepackage, and it does the rest.The KOMA-Script replacements for the book and report classes (scrbook andscrreprt offers class options cleardoubleempty, cleardoubleplain and cleardoublestandard(using the running page style, as normal) that control the appearance of these emptypages. The classes also offer do-it-yourself commands \cleardoubleempty (etc.).The memoir class (and the nextpage package) provide commands \cleartooddpageand \cleartoevenpage, which both take an optional argument (the first, with no ar-gument, being an equivalent of \cleardoublepage). One can achieve ‘special’ effectsby putting commands in the optional argument: the \clearemptydoublepage we’reafter would be achieved by \cleartooddpage[\thispagestyle{empty}]. Thecommands will also serve if you want the surreal effect of “This page intentionally leftblank” in the centre of an otherwise empty page. emptypage.sty: macros/latex/contrib/emptypage fancyhdr.sty: macros/latex/contrib/fancyhdr memoir.cls: macros/latex/contrib/memoir nextpage.sty: macros/latex/contrib/misc/nextpage.sty scrbook.cls, scrrept.cls: Part of macros/latex/contrib/koma-script 199 Balancing columns at the end of a document The twocolumn option of the standard classes causes LaTeX to set the text of a doc-ument in two columns. However, the last page of the document typically ends upwith columns of different lengths — such columns are said to be “unbalanced”. Many(most?) people don’t like unbalanced columns.The simplest solution to the problem is to use the multicol package in place of thetwocolumn option, as multicol balances the columns on the final page by default. How-ever, the use of multicol does come at a cost: its special output routine disallows the use129 of in-column floats, though it does still permit full-width (e.g., figure* environment)floats.As a result, there is a constant push for a means of balancing columns at the endof a twocolumn document. Of course, the job can be done manually: \pagebreakinserted at the appropriate place on the last page can often produce the right effect, butthis seldom appeals, and if the last page is made up of automatically-generated text (forexample, bibliography or index) inserting the command will be difficult.The flushend package offers a solution to this problem. It’s a somewhat dangerouspiece of macro code, which patches one of the most intricate parts of the LaTeX kernelwithout deploying any of the safeguards discussed in patching commands. The packageonly changes the behaviour at end document (its \flushend command is enabled bydefault), and one other command permits adjustment of the final balance; other pack-ages in the bundle provide means for insertion of full width material in two-columndocuments.The balance package also patches the output routine (somewhat more carefullythan flushend).The user should be aware that any of these packages are liable to become confusedin the presence of floats: if problems arise, manual adjustment of the floats in thedocument is likely to be necessary. It is this difficulty (what’s required in any instancecan’t really be expressed in current LaTeX) that led the author of multicol to suppresssingle-column-wide floats. balance.sty: Distributed as part of macros/latex/contrib/preprint flushend.sty: Distributed as part of macros/latex/contrib/sttools multicol.sty: Distributed as part of macros/latex/required/tools 200 My section title is too wide for the page header By default, LaTeX sectioning commands make the chapter or section title available foruse by page headers and the like. Page headers operate in a rather constrained area, andit’s common for titles too be too big to fit: the LaTeX sectioning commands thereforetake an optional argument: \section[short title]{full title} If the 〈short title〉 is present, it is used both for the table of contents and for the pageheading. The usual answer to people who complain that their title is too big for therunning head is to suggest that they the optional argument.However, using the same text for the table of contents as for the running head mayalso be unsatisfactory: if your chapter titles are seriously long (like those of a Victoriannovel), a valid and rational scheme is to have a shortened table of contents entry, and areally terse entry in the running head.One of the problems is the tendency of page headings to be set in capitals (whichtake up more space); so why not set headings as written for “ordinary” reading? It’snot possible to do so with unmodified LaTeX, but the fancyhdr package provides acommand \nouppercase for use in its header (and footer) lines to suppress LaTeX’suppercasing tendencies. Classes in the KOMA-script bundle don’t uppercase in the firstplace.In fact, the sectioning commands use ‘mark’ commands to pass information tothe page headers. For example, \chapter uses \chaptermark, \section uses\sectionmark, and so on. With this knowledge, one can achieve a three-layer struc-ture for chapters: \chapter[middling version]{verbose version}\chaptermark{terse version} which should supply the needs of every taste.Chapters, however, have it easy: hardly any book design puts a page header ona chapter start page. In the case of sections, one has typically to take account of thenature of the \*mark commands: the thing that goes in the heading is the first mark130 on the page (or, failing any mark, the last mark on any previous page). As a result therecipe for sections is more tiresome: \section[middling version]{verbose version%\sectionmark{terse version}}\sectionmark{terse version} (the first \sectionmark deals with the header of the page the \section command fallson, and the second deal with subsequent pages; note that here, you need the optionalargument to \section, even if “middling version” is in fact the same text as “longversion”.)A similar arrangement is necessary even for chapters if the class you’re using isodd enough that it puts a page header on a chapter’s opening page.Note that the titlesec package manages the running heads in a completely differentfashion; users of that package should refer to the documentation.The memoir class avoids all the silliness by providing an extra optional argumentfor chapter and sectioning commands, for example: \section[middling version][terse version]{verbose version} As a result, it is always possible for users of memoir to tailor the header text to fit, withvery little trouble. fancyhdr.sty: macros/latex/contrib/fancyhdr KOMA script bundle: macros/latex/contrib/koma-script memoir.cls: macros/latex/contrib/memoir titlesec.sty: macros/latex/contrib/titlesec 201 Page numbering “〈n〉 of 〈m〉” Finding the page number of the last page of a document, from within the document, issomewhat tricky. The lastpage package is therefore supplied to make life easy for usall; it defines a label LastPage whose number is right (after sufficiently many passesthrough LaTeX, of course). The memoir class also defines a “last page” label.The documentation of the fancyhdr package spells out exactly how one might ac-tually use this information to produce page numbering as suggested in the question. fancyhdr documentation: macros/latex/contrib/fancyhdr lastpage.sty: macros/latex/contrib/lastpage 202 Page numbering by chapterWhen I was a young man, a common arrangement for loose bound technical manualsis to number pages by chapter. (It’s quite a good scheme, in those situations: even ifyour corrections add a whole page to the chapter, the most you have to redistribute isthat chapter.)The problem, at first sight, seems pretty much the same as that in another answeron running numbers within a chapter, and the basic technique is indeed pretty similar.However, tidying-up loose ends, making sure the page number gets reset to thecorrect value at the start of each chapter, and so on, is slightly more challenging. Thisis why the chappg package was written: it does the obvious things, and more.Users have been known to ask for running page numbers within a section, but thisreally doesn’t make sense: you need to run page numbers within document objects thatalways start on a fresh page. chappg.sty: macros/latex/contrib/chappg O.3 Page layout203 The size of printed output The final product of a (La)TeX run is something for a person to read. Often, nowadays,that product will be read “on-screen”, but the printed page remains a principal outputform.131 When we come to print our output, it is important that the output fits on the paper;in some cases, for the output to “fit” is good enough. However, there are circumstanceswhere the actual size of the printed output, on the page, is crucial to the acceptance ofthe output. (This might happen when the output is a book to be published, or when it’sa dissertation which must match the fancies of some bureaucrat even to be considered.)Sadly, we often find that the printed output doesn’t conform to our expectations. . .The check-list for such problems has two entries: • Your output is generated via Adobe Reader (or possibly “Acrobat Reader” —older versions of the program had the qualified name). In this case, it may be thatReader is willfully changing the size of your output: read Reader antics.• Something in your TeX system is producing the wrong size (or shape) of output:read paper geometry. An alternative approach is to use the (excellent) testflow suite, that provides a de-tailed outline of the potential problems together with a sample document and prototypeoutputs. testflow bundle: macros/latex/contrib/IEEEtran/testflow 204 Adobe Reader messing with print size Printing from Adobe Reader shrinks the page “to fit” (by default). Unfortunately, itscalculation doesn’t consider the existing margins of the document, so that it shrinkswhat it believes is your whole page onto what it believes is its output page. The effecttypically looks as if your margins have expanded.Solve this problem by adjusting the Reader’s default in the print dialogue; unfortu-nately, this dialogue varies from one version to the next: • Reader version 7:Page Scaling (default: “Fit to printer margins”) — change to “None”, andScale (default 95% of Normal size) — change to “100%”.• Adobe Reader 6:in the print dialogue, on the “copies & pages” pane, you’ll find a popup menu/drop-down list titled “Page Scaling” — change to “None”.• Windows, Linux Acrobat (Reader) 5.0:In the print dialog, make sure the “Shrink oversized pages to fit” checkbox isunchecked. It may also be useful to uncheck the “Expand small pages to fit papersize” checkbox as well. 205 Getting the right paper geometry from (La)TeX If your output is the wrong size, and you’ve checked that it’s not due to the ministrationsof Adobe Reader, the problem is probably that your (La)TeX system is producingoutput that specifies the wrong paper size. Paper sizes can be a pain: they’re a forgottenbackwater — Knuth seems not to have considered paper size as something the TeXengine needs to know about. As a result, there is no DVI command to specify the paperon which the document should be printed, which has led a dichotomy where macrosshape the text according to the needs of the author’s chosen paper size, and devicedrivers’ choice happens independently of the macros’ ideas.In practice, one usually finds that macro packages (such as Plain TeX and LaTeX)assume American “letter” paper size, by default; and since most distributions nowadaysoriginate in Europe, the drivers usually default to ISO “A4” paper size.This is (of course) pretty unsatisfactory. Users may select a different paper sizefor their document (current LaTeX offers a range of sizes as options in the standardclasses), pretty easily. Nevertheless, the user also has to be sure that each time xdvi,dvips (or whatever) runs, it uses the paper size the document was designed for.The default paper size for DVI drivers may be changed by a distribution manage-ment command (texconfig for TeX Live, the Options application for MiKTeX), but thisstill doesn’t provide for people using the “wrong” sort of paper for some reason.A different issue arises for users of PDFTeX — the PDF format does have themeans of expressing paper size and PDFTeX has system variables \pdfpagewidth132 and \pdfpageheight, that are written into the output PDF file. Unfortunately, mostof the core software predates PDFTeX, so not even PDFLaTeX sets the correct valuesinto those variables, to match the paper size specified in a \documentclass option.The DVI drivers dvips, dvipdfm and its extensions (dvipdfmx and xdvipdfmx) de-fine \special commands for the document to specify its own paper size; so in thosecases, as when PDFTeX or VTeX is being used, the paper size can be programmed bythe document. Users who wish to, may of course consult the manuals of the variousprograms to write the necessary code.The geometry package (whose main business is defining typeset page areas), alsotakes notice the size of the paper that the document is going to be printed on, and canissue the commands necessary to ensure the correct size of paper is used. If geometryis used when a document is being processed by PDFLaTeX, it can set the necessarydimensions “in the output”. If the document is being processed by LaTeX on a TeXor e-TeX engine, there are package options which instruct geometry which \specialcommands to use. (Note that the options are ignored if you are using either PDFLaTeXor VTeX.)So, the resolution of the problem, when you are using LaTeX, is to add \usepackage[processor-option,...]{geometry} Where processor-option tells the package what will produce your (PostScript orPDF driver — geometry knows about dvips and dvipdfm (dvipdfm also serves forthe extension dvipdfmx and xdvipdfmx).If you’re using PDFLaTeX, XeTeX or VTeX, load with \usepackage[program-option,...]{geometry} where program-option is pdftex, xetex or vtex.Needless to say, both the “big” classes (koma-script and memoir) provide their ownways to get the paper size “right”.The typearea package is the Koma-script distribution’s way of providing page lay-out functionality. Load it with the pagesize option and it will ensure the correct paperis selected, for PDF output from PDFLaTeX, and for PostScript output from LaTeXvia dvips.Memoir has the standard classes’ paper-size selections (a4paper, letterpaperand so on), but also permits the user to choose an arbitrary paper size, by setting thelength registers \stockheight and \stockwidth. The commands \fixdvipslayout(for LaTeX processing), and \fixpdflayout (for PDFLaTeX processing) then instructthe processor to produce output that specifies the necessary paper size. geometry.sty: macros/latex/contrib/geometry memoir.cls: macros/latex/contrib/memoir typearea.sty: Distributed as part of macros/latex/contrib/koma-script 206 Changing the margins in LaTeX Changing the layout of a document’s text on the page involves several subtleties notoften realised by the beginner. There are interactions between fundamental TeX con-straints, constraints related to the design of LaTeX, and good typesetting and designpractice, that mean that any change must be very carefully considered, both to ensurethat it “works” and to ensure that the result is pleasing to the eye.LaTeX’s defaults sometimes seem excessively conservative, but there are soundreasons behind how Lamport designed the layouts themselves, whatever one may feelabout his overall design. For example, the common request for “one-inch margins allround on A4 paper” is fine for 10or 12-pitch typewriters, but not for 10pt (or even11pt or 12pt) type because readers find such wide, dense, lines difficult to read. Thereshould ideally be no more than 75 characters per line (though the constraints changefor two-column text).So Lamport’s warning to beginners in his section on ‘Customizing the Style’ —“don’t do it” — should not lightly be ignored.133 This set of FAQs recommends that you use a package to establish consistent settingsof the parameters: the interrelationships are taken care of in the established packages,without you needing to think about them, but remember — the packages only provideconsistent, working, mechanisms: they don’t analyse the quality of what you proposeto do.The following answers deal with the ways one may choose to proceed: • Choose which package to use.• Find advice on setting up page layout by hand. There is a related question — how to change the layout temporarily — and there’s ananswer that covers that, too: • Change the margins on the fly. 207 Packages to set up page designsThe ‘ultimate’ tool for adjusting the dimensions and position of the printed material onthe page is the geometry package; a very wide range of adjustments of the layout maybe relatively straightforwardly programmed, and package documentation is good andcomprehensive.As is usual, users of the memoir class have built-in facilities for this task, and usersof the KOMA-script classes are recommended to use an alternative package, typearea.In either case it is difficult to argue that users should go for geometry: both alternativesare good.The documentation of geometry is a bit overwhelming, and learning all its capabili-ties may be more than you ever need. Somewhat simpler to use is the vmargin package,which has a canned set of paper sizes (a superset of that provided in LaTeX2e), provi-sion for custom paper, margin adjustments and provision for two-sided printing. geometry.sty: macros/latex/contrib/geometry KOMA script bundle: macros/latex/contrib/koma-script layout.sty: Distributed as part of macros/latex/required/tools memoir.cls: macros/latex/contrib/memoir typearea.sty: Distributed as part of macros/latex/contrib/koma-script vmargin.sty: macros/latex/contrib/vmargin 208 How to set up page layout “by hand” So you’re eager to do it yourself, notwithstanding the cautions outlined in “changingmargins”.It’s important that you first start by familiarising yourself with LaTeX’s page layoutparameters. For example, see section C.5.3 of the LaTeX manual (pp. 181-182), orcorresponding sections in many of the other good LaTeX manuals (see LaTeX books).LaTeX controls the page layout with a number of parameters, which allow you tochange the distance from the edges of a page to the left and top edges of your typesettext, the width and height of the text, and the placement of other text on the page. How-ever, they are somewhat complex, and it is easy to get their interrelationships wrongwhen redefining the page layout. The layout package defines a \layout commandwhich draws a diagram of your existing page layout, with the dimensions (but not theirinterrelationships) shown.Even changing the text height and width, \textheight and \textwidth, requiresmore care than you might expect: the height should be set to fit a whole number of textlines (in terms of multiples of \baselinskip), and the width should be constrained bythe number of characters per line, as mentioned in “changing margins”.Margins are controlled by two parameters: \oddsidemargin and \evensidemargin,whose names come from the convention that odd-numbered pages appear on the right-hand side (‘recto’) of a two-page spread and even-numbered pages on the left-handside (‘verso’). Both parameters actually refer to the left-hand margin of the relevantpages; in each case the right-hand margin is specified by implication, from the value of134 \textwidth and the width of the paper. (In a one-sided document, which is the defaultin many classes, including the standard article and report classes, \oddsidemarginstands for both.)The “origin” (the zero position) on the page is one inch from the top of the paperand one inch from the left side; positive horizontal measurements extend right acrossthe page, and positive vertical measurements extend down the page. Thus, the parame-ters \evensidemargin, \oddsidemargin and \topmargin, should be set to be 1 inchless than the true margin; for margins closer to the left and top edges of the page than1 inch, the margin parameters must be set to negative values. 209 Changing margins “on the fly” One of the surprises characteristic of TeX use is that you cannot change the width orheight of the text within the document, simply by modifying the text size parameters;TeX can’t change the text width on the fly, and LaTeX only ever looks at text heightwhen starting a new page.So the simple rule is that the parameters should only be changed in the preamble ofthe document, i.e., before the \begin{document} statement (so before any typesettinghas happened.To adjust text width within a document we define an environment: \newenvironment{changemargin}[2]{%\begin{list}{}{%\setlength{\topsep}{0pt}%\setlength{\leftmargin}{#1}%\setlength{\rightmargin}{#2}%\setlength{\listparindent}{\parindent}%\setlength{\itemindent}{\parindent}%\setlength{\parsep}{\parskip}%}%\item[]}{\end{list}} The environment takes two arguments, and will indent the left and right margins, re-spectively, by the parameters’ values. Negative values will cause the margins to benarrowed, so \begin{changemargin}{-1cm}{-1cm} narrows the left and right mar-gins by 1 centimetre.Given that TeX can’t do this, how does it work? — well, the environment (which isa close relation of the LaTeX quote environment) doesn’t change the text width as faras TeX is concerned: it merely moves text around inside the width that TeX believesin.The changepage package provides ready-built commands to do the above; itincludes provision for changing the shifts applied to your text according to whetheryou’re on an odd (recto) or an even (verso) page of a two-sided document. Changepage’sstructure matches that of the memoir class.The (earlier) package chngpage provides the same facilities, but it uses rather dif-ferent syntax. Changepage’s structure matches that of the memoir class, and it shouldbe used for any new work.Changing the vertical dimensions of a page is more clumsy still: the LaTeX com-mand \enlargethispage adjusts the size of the current page by the size of its argu-ment. Common uses are \enlargethispage{\baselineskip} to make the page one line longer, or \enlargethispage{-\baselineskip} to make the page one line shorter. The process is (to an extent) simplified by theaddlines package: its \addlines command takes as argument the number of lines toadd to the page (rather than a length): the package documentation also provides a usefulanalysis of when the command may (or may not) be expected to work.135 addlines.sty: macros/latex/contrib/addlines changepage.sty: macros/latex/contrib/changepage 210 How to get rid of page numbers Very occasionally, one wants a document with no page numbers. For such occa-sions, the package nopageno will make \pagestyle{plain} have the same effect as\pagestyle{empty}; in simple documents, this will suppress all page numbering (itwill not work, of course, if the document uses some other pagestyle than plain).To suppress page numbers from a sequence of pages, you may use \pagestyle{empty} at the start of the sequence, and restore the original page style at the end.Unfortunately, you still have to deal with the page numbers on pages containing a\maketitle, \part or \chapter command, since the standard classes; deal with thoseseparately, as described below.To suppress page numbers on a single page, use \thispagestyle{empty} some-where within the text of the page. Note that, in the standard classes, \maketitle and\chapter use \thispagestyle internally, so your call must be after those commands.Unfortunately, \thispagestyle doesn’t work for book or report \part com-mands: they set the page style (as do \chapter commands), but then they ad-vance to the next page so that you have no opportunity to change the style using\thispagestyle. The present author has proposed solving the problem with thefollowing “grubby little patch”, on comp.text.tex: \makeatletter\let\sv@endpart\@endpart\def\@endpart{\thispagestyle{empty}\sv@endpart}\makeatother Both the KOMA-script classes and memoir have separate page styles for the stylesof various “special” pages, so, in a KOMA class document one might say: \renewcommand*{\titlepagestyle}{empty} while memoir will do the job with \aliaspagestyle{title}{empty} An alternative (in all classes) is to use the rather delightful \pagenumbering{gobble}; this has the simple effect that any attempt to print a page number producesnothing, so there’s no issue about preventing any part of LaTeX from printing thenumber. However, the \pagenumbering command does have the side effect that itresets the page number (to 1), so it is unlikely to be helpful other than at the beginningof a document.The scrpage2 package separates out the representation of the page number (it type-sets the number using the \pagemark command) from the construction of the pageheader and footer; so one can say \renewcommand*{\pagemark}{} which will also suppress the printing of the page number.Neither of these “suppress the page number” techniques touches the page style inuse; in practice this means they don’t make sense unless you are using \pagestyle{plain} fancyhdr.sty: macros/latex/contrib/fancyhdr KOMA script bundle: macros/latex/contrib/koma-script memoir.cls: macros/latex/contrib/memoir nopageno.sty: macros/latex/contrib/nopageno scrpage2.sty: Distributed as part of macros/latex/contrib/koma-script

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

The UK TeX FAQ

= "{\input{abstracts/long.tex}}"

متن کامل

The UK TeX FAQ

sty : macros/latex/contrib/abstract memoir.cls : macros/latex/contrib/memoir

متن کامل

The UK TeX FAQ

sty: macros/latex/contrib/abstract memoir.cls: macros/latex/contrib/memoir 179 Really blank pages between chapters Book (by default) and report (with openright class option) ensure that each chapterstarts on a right-hand (recto) page; they do this by inserting a \cleardoublepage

متن کامل

The UK TeX FAQ

sty: macros/latex/contrib/abstract memoir.cls: macros/latex/contrib/memoir 198 Really blank pages between chapters If you’re using the standard classes, you need to take special action; the memoir classand the Koma-Script classes provide their own support for this — see below.Book (by default) and report (with openright class option) ensure that each chap-ter starts on a right-hand ...

متن کامل

Investigating the Energy Efficiency of TEX High Energy Derivatives with Different Carbon Fuller Nano Structures under Different Temperature Conditions by DFT Method

In this study, high energy energy derivatives of TEX with different carbon-containing fullerenes at different temperature conditions were studied using density functional theory. For this purpose, the materials were first geometric optimized, then the thermodynamic parameters were calculated for all of them. Then, the process of changing the energy-dependent parameters such as specific heat cap...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2011